<?php
/**
 * Created by PhpStorm.
 * User: Yixiao Chen
 * Date: 2015/5/29 0029
 * Time: 下午 3:15
 */

namespace Appstore\Model;


use Think\Model;

class AppstoreWebsiteModel extends Model
{

    /**是否已经绑定网站
     * @param $uid
     * @return mixed
     */
    public function isBinded($uid)
    {
        $has_binded = $this->where(array('uid' => $uid,'status'=>1))->count();
        return $has_binded;
    }

    public function checkWebsiteIsExist($website){
        $has_binded = $this->where(array('domain' => $website))->find();
        if($has_binded){
            if($has_binded['uid'] == is_login()){
                return false;
            }else{
                return true;
            }
        }else{
            return false;
        }
    }
}